<div class="module-admin">
    <ol class="breadcrumb">
        <li>账户管理</li>
        <li>账户管理</li>
    </ol>

    <table class="table table-bordered form-inline">
        <tr>
            <th width="12%">模块</th>
            <th width="88%">功能</th>
        </tr>
        <tr>
            <td style="vertical-align: middle">后台重置密码</td>
            <td>
                原密码：
                <input type="password" class="form-control" ng-model="vm.oldPassword">
                新密码：
                <input type="password" class="form-control" ng-model="vm.newPassword">
                确认新密码：
                <input type="password" class="form-control" ng-model="vm.confirmPassword">
                <button class="btn btn-primary" ng-click="vm.setLoginPassword()"
                    data-ng-disabled="!vm.oldPassword||!vm.newPassword||!vm.confirmPassword">确认</button>
            </td>
        </tr>
        <tr ng-if="vm.role=='ADMIN'">
            <td style="vertical-align: middle" >后台创建管理员</td>
            <td>
                用户名：
                <input type="text" class="form-control" ng-model="vm.userName">
                角色：
                <select class="form-control" ng-model="vm.createRole">
                    <option value="">请选择</option>
                    <option value="ACCOUNTANT">会计</option>
                    <option value="CUSTOM_SERVICE">客服</option>
                </select>
                电话：
                <input type="text" class="form-control" ng-model="vm.account">
                密码：
                <input type="password" class="form-control" ng-model="vm.password">
                <button class="btn btn-primary"
                        data-ng-disabled="!vm.userName||!vm.createRole||!vm.account||!vm.password"
                        ng-click="vm.create()">确认</button>
            </td>

        </tr>
        <!--<tr ng-if="vm.role=='ADMIN'">-->
            <!--<td style="vertical-align: middle">后台锁定管理员</td>-->
            <!--<td>-->
                <!--<select class="form-control" ng-model="vm.unlockUid"  style=" width: 100px;">-->
                    <!--<option value="">请选择</option>-->
                    <!--<option ng-if="vm.lockList.length>0"-->
                            <!--ng-repeat="item in vm.lockList"-->
                            <!--value="{{item.uid}}">-->
                        <!--{{item.opName}}-->
                    <!--</option>-->
                <!--</select>-->
                <!--<button class="btn btn-primary" ng-click="vm.unlock()" data-ng-disabled="!vm.unlockUid">解锁</button>-->
            <!--</td>-->

        <!--</tr>-->
        <!--<tr ng-if="vm.role=='ADMIN'">-->
            <!--<td style="vertical-align: middle">后台解锁管理员</td>-->
            <!--<td>-->
                <!--<select class="form-control" ng-model="vm.lockUid" style=" width: 100px;">-->
                    <!--<option value="">请选择</option>-->
                    <!--<option ng-if="vm.unlockList.length>0"-->
                            <!--ng-repeat="item in vm.unlockList"-->
                            <!--value="{{item.uid}}" >-->
                        <!--{{item.opName}}-->
                    <!--</option>-->
                <!--</select>-->
                <!--<button class="btn btn-primary" ng-click="vm.lock()" data-ng-disabled="!vm.lockUid">锁定</button>-->
            <!--</td>-->
        <!--</tr>-->
    </table>




    <div class="ui-box" ng-if="vm.role=='ADMIN'">
        <form class="form-inline ui-form" role="form">
            <div class="form-group">
                <label>状态</label>
                <select class="form-control" ng-model="vm.status" ng-change="vm._fetchList()">
                    <option value="">全部</option>
                    <option value="LOCK">已锁定</option>
                    <option value="UNLOCK">可用</option>
                </select>
            </div>
        </form>
        <table class="table table-striped table-hover">
            <thead>
            <tr>
                <th width="20%">UID</th>
                <th width="25%">账号</th>
                <th width="25%">角色</th>
                <th width="25%">状态</th>
                <th width="35%">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="item in vm.list" ng-if="vm.isLoading === false && vm.list.length > 0">
                <td>{{item.uid}}</td>
                <td>{{item.account}}</td>
                <td>
                    <!--<span ng-if="item.role === 'ADMIN'">管理员</span>-->
                    <!--<span ng-if="item.role === 'CUSTOM_SERVICE'">客服</span>-->
                    <!--<span ng-if="item.role === 'ACCOUNTANT'">会计</span>-->
                    <span>{{vm.returnRole(item.role)}}</span>
                </td>
                <td>
                    <span ng-if="item.locked === 'UNLOCK'">可用</span>
                    <span ng-if="item.locked === 'LOCK'">已锁定</span>
                </td>
                <td>
                    <a href="javascript:;" ng-click="vm.lock(item.uid)" ng-if="item.locked === 'UNLOCK'">锁定</a>
                    <a href="javascript:;" ng-click="vm.unlock(item.uid)" ng-if="item.locked === 'LOCK'">解锁</a>
                </td>
            </tr>
            <tr class="ui-no-data" ng-if="vm.isLoading === false && (vm.list.length === 0||vm.list===null)">
                <td colspan="5">暂无数据</td>
            </tr>
            <tr class="ui-loading" ng-if="vm.isLoading === true">
                <td colspan="5">正在加载，请稍候...</td>
            </tr>
            </tbody>
        </table>
    </div>


</div>